<?php

class Core_Frontend_Module_Customer_Detail extends Dcmp_Module_Base {

    protected $name = 'customer_detail';
    public function install() {

    }

    public function uninstall() {

    }

    public function buildConfig($form) {
        $form->addTextBoxField($this->__('customer.label.customer_id'), 'customer_id', 'module[parameters][customer_id]', TRUE);
        $form->createTab('module_option', $this->__('design.label.module_parameter'),
                array('field_customer_id'));
    }

    public function render() {
        $parameters = $this->getParameters();
        if ($this->getVariables()->issetData('current_customer')) {
            $customer = $this->getVariables()->getCurrentCustomer();
        } else {
            $id = $this->getDynamicParameter($parameters['customer_id']);
            if(is_null($id)){
                $id = $parameters['customer_id'];
            }
            $customer = App::getModel('customer/detail')->load($id);
        }
        $tmpl = $this->getTemplate()->assign('customer', $customer);
        return $tmpl->render($this->getTemplatePath());
    }

}